.class public Lcom/netease/newsreader/weibo/QWeiboSyncApi;
.super Ljava/lang/Object;
.source "QWeiboSyncApi.java"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 15
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public getAccessToken(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .locals 8
    .parameter "customKey"
    .parameter "customSecret"
    .parameter "requestToken"
    .parameter "requestTokenSecrect"
    .parameter "verify"

    .prologue
    .line 64
    const-string v1, "http://open.t.qq.com/cgi-bin/access_token"

    .line 65
    .local v1, url:Ljava/lang/String;
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    .line 66
    .local v4, parameters:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    new-instance v3, Lcom/mime/qweibo/OauthKey;

    invoke-direct {v3}, Lcom/mime/qweibo/OauthKey;-><init>()V

    .line 67
    .local v3, oauthKey:Lcom/mime/qweibo/OauthKey;
    iput-object p1, v3, Lcom/mime/qweibo/OauthKey;->customKey:Ljava/lang/String;

    .line 68
    iput-object p2, v3, Lcom/mime/qweibo/OauthKey;->customSecrect:Ljava/lang/String;

    .line 69
    iput-object p3, v3, Lcom/mime/qweibo/OauthKey;->tokenKey:Ljava/lang/String;

    .line 70
    iput-object p4, v3, Lcom/mime/qweibo/OauthKey;->tokenSecrect:Ljava/lang/String;

    .line 71
    iput-object p5, v3, Lcom/mime/qweibo/OauthKey;->verify:Ljava/lang/String;

    .line 73
    new-instance v0, Lcom/mime/qweibo/QWeiboRequest;

    invoke-direct {v0}, Lcom/mime/qweibo/QWeiboRequest;-><init>()V

    .line 74
    .local v0, request:Lcom/mime/qweibo/QWeiboRequest;
    const/4 v7, 0x0

    .line 76
    .local v7, res:Ljava/lang/String;
    :try_start_0
    const-string v2, "GET"

    const/4 v5, 0x0

    invoke-virtual/range {v0 .. v5}, Lcom/mime/qweibo/QWeiboRequest;->syncRequest(Ljava/lang/String;Ljava/lang/String;Lcom/mime/qweibo/OauthKey;Ljava/util/List;Ljava/util/List;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v7

    .line 80
    :goto_0
    return-object v7

    .line 77
    :catch_0
    move-exception v6

    .line 78
    .local v6, e:Ljava/lang/Exception;
    invoke-virtual {v6}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method

.method public getHomeMsg(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/netease/newsreader/weibo/QWeiboType$ResultType;Lcom/netease/newsreader/weibo/QWeiboType$PageFlag;I)Ljava/lang/String;
    .locals 10
    .parameter "customKey"
    .parameter "customSecret"
    .parameter "requestToken"
    .parameter "requestTokenSecrect"
    .parameter "format"
    .parameter "pageFlag"
    .parameter "nReqNum"

    .prologue
    .line 106
    const-string v1, "http://open.t.qq.com/api/statuses/home_timeline"

    .line 107
    .local v1, url:Ljava/lang/String;
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    .line 108
    .local v4, parameters:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    new-instance v3, Lcom/mime/qweibo/OauthKey;

    invoke-direct {v3}, Lcom/mime/qweibo/OauthKey;-><init>()V

    .line 109
    .local v3, oauthKey:Lcom/mime/qweibo/OauthKey;
    iput-object p1, v3, Lcom/mime/qweibo/OauthKey;->customKey:Ljava/lang/String;

    .line 110
    iput-object p2, v3, Lcom/mime/qweibo/OauthKey;->customSecrect:Ljava/lang/String;

    .line 111
    iput-object p3, v3, Lcom/mime/qweibo/OauthKey;->tokenKey:Ljava/lang/String;

    .line 112
    iput-object p4, v3, Lcom/mime/qweibo/OauthKey;->tokenSecrect:Ljava/lang/String;

    .line 114
    const/4 v8, 0x0

    .line 115
    .local v8, strFormat:Ljava/lang/String;
    sget-object v2, Lcom/netease/newsreader/weibo/QWeiboType$ResultType;->ResultType_Xml:Lcom/netease/newsreader/weibo/QWeiboType$ResultType;

    if-ne p5, v2, :cond_0

    .line 116
    const-string v8, "xml"

    .line 123
    :goto_0
    new-instance v2, Lcom/mime/qweibo/QParameter;

    const-string v5, "format"

    invoke-direct {v2, v5, v8}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v4, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 124
    new-instance v2, Lcom/mime/qweibo/QParameter;

    const-string v5, "pageflag"

    .line 125
    invoke-virtual/range {p6 .. p6}, Lcom/netease/newsreader/weibo/QWeiboType$PageFlag;->ordinal()I

    move-result v9

    .line 124
    invoke-static {v9}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v9

    invoke-direct {v2, v5, v9}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v4, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 126
    new-instance v2, Lcom/mime/qweibo/QParameter;

    const-string v5, "reqnum"

    invoke-static/range {p7 .. p7}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v9

    invoke-direct {v2, v5, v9}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v4, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 128
    new-instance v0, Lcom/mime/qweibo/QWeiboRequest;

    invoke-direct {v0}, Lcom/mime/qweibo/QWeiboRequest;-><init>()V

    .line 129
    .local v0, request:Lcom/mime/qweibo/QWeiboRequest;
    const/4 v7, 0x0

    .line 131
    .local v7, res:Ljava/lang/String;
    :try_start_0
    const-string v2, "GET"

    const/4 v5, 0x0

    invoke-virtual/range {v0 .. v5}, Lcom/mime/qweibo/QWeiboRequest;->syncRequest(Ljava/lang/String;Ljava/lang/String;Lcom/mime/qweibo/OauthKey;Ljava/util/List;Ljava/util/List;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v7

    .line 135
    .end local v0           #request:Lcom/mime/qweibo/QWeiboRequest;
    .end local v7           #res:Ljava/lang/String;
    :goto_1
    return-object v7

    .line 117
    :cond_0
    sget-object v2, Lcom/netease/newsreader/weibo/QWeiboType$ResultType;->ResultType_Json:Lcom/netease/newsreader/weibo/QWeiboType$ResultType;

    if-ne p5, v2, :cond_1

    .line 118
    const-string v8, "json"

    goto :goto_0

    .line 120
    :cond_1
    const-string v7, ""

    goto :goto_1

    .line 132
    .restart local v0       #request:Lcom/mime/qweibo/QWeiboRequest;
    .restart local v7       #res:Ljava/lang/String;
    :catch_0
    move-exception v6

    .line 133
    .local v6, e:Ljava/lang/Exception;
    invoke-virtual {v6}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_1
.end method

.method public getRequestToken(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .locals 8
    .parameter "customKey"
    .parameter "customSecret"
    .parameter "callbackUrl"

    .prologue
    .line 27
    const-string v1, "http://open.t.qq.com/cgi-bin/request_token"

    .line 28
    .local v1, url:Ljava/lang/String;
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    .line 29
    .local v4, parameters:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    new-instance v3, Lcom/mime/qweibo/OauthKey;

    invoke-direct {v3}, Lcom/mime/qweibo/OauthKey;-><init>()V

    .line 30
    .local v3, oauthKey:Lcom/mime/qweibo/OauthKey;
    iput-object p1, v3, Lcom/mime/qweibo/OauthKey;->customKey:Ljava/lang/String;

    .line 31
    iput-object p2, v3, Lcom/mime/qweibo/OauthKey;->customSecrect:Ljava/lang/String;

    .line 34
    iput-object p3, v3, Lcom/mime/qweibo/OauthKey;->callbackUrl:Ljava/lang/String;

    .line 36
    new-instance v0, Lcom/mime/qweibo/QWeiboRequest;

    invoke-direct {v0}, Lcom/mime/qweibo/QWeiboRequest;-><init>()V

    .line 37
    .local v0, request:Lcom/mime/qweibo/QWeiboRequest;
    const/4 v7, 0x0

    .line 39
    .local v7, res:Ljava/lang/String;
    :try_start_0
    const-string v2, "GET"

    const/4 v5, 0x0

    invoke-virtual/range {v0 .. v5}, Lcom/mime/qweibo/QWeiboRequest;->syncRequest(Ljava/lang/String;Ljava/lang/String;Lcom/mime/qweibo/OauthKey;Ljava/util/List;Ljava/util/List;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v7

    .line 43
    :goto_0
    return-object v7

    .line 40
    :catch_0
    move-exception v6

    .line 41
    .local v6, e:Ljava/lang/Exception;
    invoke-virtual {v6}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method

.method public publishMsg(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/netease/newsreader/weibo/QWeiboType$ResultType;)Ljava/lang/String;
    .locals 15
    .parameter "customKey"
    .parameter "customSecret"
    .parameter "requestToken"
    .parameter "requestTokenSecrect"
    .parameter "content"
    .parameter "pic"
    .parameter "format"

    .prologue
    .line 161
    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    .line 162
    .local v6, files:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    const/4 v2, 0x0

    .line 163
    .local v2, url:Ljava/lang/String;
    const-string v3, "POST"

    .line 165
    .local v3, httpMethod:Ljava/lang/String;
    if-eqz p6, :cond_0

    invoke-virtual/range {p6 .. p6}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v11

    const-string v12, ""

    invoke-virtual {v11, v12}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v11

    if-eqz v11, :cond_1

    .line 166
    :cond_0
    const-string v2, "http://open.t.qq.com/api/t/add"

    .line 172
    :goto_0
    new-instance v4, Lcom/mime/qweibo/OauthKey;

    invoke-direct {v4}, Lcom/mime/qweibo/OauthKey;-><init>()V

    .line 173
    .local v4, oauthKey:Lcom/mime/qweibo/OauthKey;
    move-object/from16 v0, p1

    iput-object v0, v4, Lcom/mime/qweibo/OauthKey;->customKey:Ljava/lang/String;

    .line 174
    move-object/from16 v0, p2

    iput-object v0, v4, Lcom/mime/qweibo/OauthKey;->customSecrect:Ljava/lang/String;

    .line 175
    move-object/from16 v0, p3

    iput-object v0, v4, Lcom/mime/qweibo/OauthKey;->tokenKey:Ljava/lang/String;

    .line 176
    move-object/from16 v0, p4

    iput-object v0, v4, Lcom/mime/qweibo/OauthKey;->tokenSecrect:Ljava/lang/String;

    .line 178
    new-instance v5, Ljava/util/ArrayList;

    invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V

    .line 180
    .local v5, parameters:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    const/4 v10, 0x0

    .line 181
    .local v10, strFormat:Ljava/lang/String;
    sget-object v11, Lcom/netease/newsreader/weibo/QWeiboType$ResultType;->ResultType_Xml:Lcom/netease/newsreader/weibo/QWeiboType$ResultType;

    move-object/from16 v0, p7

    if-ne v0, v11, :cond_2

    .line 182
    const-string v10, "xml"

    .line 189
    :goto_1
    new-instance v11, Lcom/mime/qweibo/QParameter;

    const-string v12, "format"

    invoke-direct {v11, v12, v10}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v5, v11}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 191
    :try_start_0
    new-instance v11, Lcom/mime/qweibo/QParameter;

    const-string v12, "content"

    new-instance v13, Ljava/lang/String;

    .line 192
    const-string v14, "UTF-8"

    move-object/from16 v0, p5

    invoke-virtual {v0, v14}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v14

    invoke-direct {v13, v14}, Ljava/lang/String;-><init>([B)V

    invoke-direct {v11, v12, v13}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 191
    invoke-interface {v5, v11}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0

    .line 197
    new-instance v11, Lcom/mime/qweibo/QParameter;

    const-string v12, "clientip"

    const-string v13, "127.0.0.1"

    invoke-direct {v11, v12, v13}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v5, v11}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 199
    new-instance v1, Lcom/mime/qweibo/QWeiboRequest;

    invoke-direct {v1}, Lcom/mime/qweibo/QWeiboRequest;-><init>()V

    .line 200
    .local v1, request:Lcom/mime/qweibo/QWeiboRequest;
    const/4 v9, 0x0

    .line 202
    .local v9, res:Ljava/lang/String;
    :try_start_1
    invoke-virtual/range {v1 .. v6}, Lcom/mime/qweibo/QWeiboRequest;->syncRequest(Ljava/lang/String;Ljava/lang/String;Lcom/mime/qweibo/OauthKey;Ljava/util/List;Ljava/util/List;)Ljava/lang/String;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    move-result-object v9

    .line 207
    .end local v1           #request:Lcom/mime/qweibo/QWeiboRequest;
    .end local v9           #res:Ljava/lang/String;
    :goto_2
    return-object v9

    .line 168
    .end local v4           #oauthKey:Lcom/mime/qweibo/OauthKey;
    .end local v5           #parameters:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    .end local v10           #strFormat:Ljava/lang/String;
    :cond_1
    const-string v2, "http://open.t.qq.com/api/t/add_pic"

    .line 169
    new-instance v11, Lcom/mime/qweibo/QParameter;

    const-string v12, "pic"

    move-object/from16 v0, p6

    invoke-direct {v11, v12, v0}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v6, v11}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 183
    .restart local v4       #oauthKey:Lcom/mime/qweibo/OauthKey;
    .restart local v5       #parameters:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    .restart local v10       #strFormat:Ljava/lang/String;
    :cond_2
    sget-object v11, Lcom/netease/newsreader/weibo/QWeiboType$ResultType;->ResultType_Json:Lcom/netease/newsreader/weibo/QWeiboType$ResultType;

    move-object/from16 v0, p7

    if-ne v0, v11, :cond_3

    .line 184
    const-string v10, "json"

    goto :goto_1

    .line 186
    :cond_3
    const-string v9, ""

    goto :goto_2

    .line 193
    :catch_0
    move-exception v8

    .line 194
    .local v8, e1:Ljava/io/UnsupportedEncodingException;
    invoke-virtual {v8}, Ljava/io/UnsupportedEncodingException;->printStackTrace()V

    .line 195
    const-string v9, ""

    goto :goto_2

    .line 204
    .end local v8           #e1:Ljava/io/UnsupportedEncodingException;
    .restart local v1       #request:Lcom/mime/qweibo/QWeiboRequest;
    .restart local v9       #res:Ljava/lang/String;
    :catch_1
    move-exception v7

    .line 205
    .local v7, e:Ljava/lang/Exception;
    invoke-virtual {v7}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_2
.end method
